package com.happycat.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import org.springframework.web.bind.annotation.RequestBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.happycat.ResponseModel;
import com.happycat.Pagination;
import com.happycat.ResponseHeaderModel;
import com.happycat.mobile.model.UserActiveMessaging;
import com.happycat.mobile.model.UserPosting;
import com.happycat.mobile.service.UserPostingService;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liaoyong
 * @since 2020-07-29
 */
@RestController
@RequestMapping("/userPosting")
@Api(value = "用户帖子消息", description = "用户帖子消息接口")
public class UserPostingController {
    @Autowired
	private UserPostingService userPostingService;
	
	@ApiOperation(value = "用户帖子消息详情")
    @RequestMapping(method = RequestMethod.POST, value = "/detail")
	public ResponseModel<UserPosting> detail(@RequestBody UserPosting userPosting){
		return userPostingService.selectOne(userPosting);
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/page")
	@ApiOperation(value = "用户帖子消息分页列表")
	public ResponseModel<Page<UserPosting>> Page(@RequestBody Pagination<UserPosting>page){
		return userPostingService.pageList(page);
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/add")
	@ApiOperation(value = "用户帖子消息新增")
	public ResponseHeaderModel add(@RequestBody UserPosting userPosting){
	
	   return userPostingService.add(userPosting);
	}
	@ApiOperation(value = "用户帖子消息编辑")
	@RequestMapping(method = RequestMethod.POST, value = "/modify")
	public ResponseHeaderModel modify(@RequestBody UserPosting userPosting){
	
	   return userPostingService.modify(userPosting);
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/cancleLike")
	@ApiOperation(value = "用户圈子帖子取消点赞")
	public ResponseHeaderModel cancleLike(@RequestBody UserPosting userPosting) {

		return userPostingService.cancleLike(userPosting);
	}
	
}

